package com.sj.aopEvolve.cglib;

/**
 * Cglib代理，也叫做子类代理
 */
public class UserDaoProxy extends UserDao {
    //接收保存目标对象
    private UserDao target;

    public UserDaoProxy(UserDao target) {
        this.target = target;
    }

    @Override
    public void save() {
        System.out.println("开始事务...");
        target.save();//执行目标对象的方法
        System.out.println("提交事务...");
    }
}
